<?php

class ChauffageCommand extends CConsoleCommand {

    public function actionActiverMode($zoneid, $modeid = null) {
	  $zone = Zone::model()->findByPk($zoneid);

	  if (is_null($zone)) {
		echo "Zone inconnue\n";
	  } else {
		$zone->activerMode($modeid);
	  }
    }
    
    
    public function actionTest(){
	  $zones = Zone::model()->findAll();
	  $modes = array('eco', 'confort', 'arret', 'horsgel');
	  
	  foreach($zones as $zone){
		foreach($modes as $modeid){
		    $this->actionActiverMode($zone->id, $modeid);
		    sleep(2);
		}
	  }
    }

}